<!DOCTYPE html PUBLIC "-//W3C//XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>POL Scripting Reference BASIC.EM</title>
		<meta name="keyword" content="POL, EScript, documentation, Ultima Online, UO, packets, client, ultima online client, emulator" />
		<meta name="description" content="Penultima Online Documentation website." />
		<meta name="Author" content="Racalac, Rykard" />
		<meta name="Generator" content="POL Doc-o-matic" />
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<link href="style.css" rel="stylesheet" type="text/css"  media="all"  />
	</head>
	<script language="JavaScript1.2" type="text/javascript">
function ExpandContract(s) {
  var bulletE = document.getElementById("bullet_"+s);
  var spanE = document.getElementById("span_"+s);
  var Expanded = bulletE.innerHTML;

  if(Expanded == '[+]') {
    spanE.style.display = 'block';
    bulletE.innerHTML = '[-]';
  }
  else { 
    spanE.style.display = 'none'; 
    bulletE.innerHTML = '[+]';
  }
}
</script>

<body>
<div class="container"><div id="doc-mini-header">
<div class="doc-home"><a href="index.html">
              Home
  				  </a></div>
<h1>
<a name="TOP"></a>
						File:
						Basic.em</h1>
<p>
						Description:
						Functions for converting and manipulating number, character, and string values.<br><b>
							Last Modified:
							03/19/2009</b></p>
</div></div><div class="container"><div class="doc-mainbox">
<div class="expander"><a href="javascript:ExpandContract('Constants')" id="bullet_Constants">[-]</a></div>
<center><h2>File Constants:</h2></center>
<span id="span_Constants"><pre>const TRIM_LEFT  := 0x1; // Trim whitespace from Left of string.<br>const TRIM_RIGHT := 0x2; // Trim whitespace from Right of string.<br>const TRIM_BOTH  := 0x3; // Trim whitespace from Left and Right of string.</pre></span>
</div></div><div id="main"><div class="container">
<div class="doc-col_2">
<div class="doc-smallbox">
<div class="expander"><a href="javascript:ExpandContract('Functions')" id="bullet_Functions">[-]</a></div>
<center><h2>Functions:</h2></center>
<span id="span_Functions"><ul>
<li><a href="#Bin">Bin</a></li>
<li><a href="#CAsc">CAsc</a></li>
<li><a href="#CAscZ">CAscZ</a></li>
<li><a href="#CChr">CChr</a></li>
<li><a href="#CChrZ">CChrZ</a></li>
<li><a href="#CDbl">CDbl</a></li>
<li><a href="#CInt">CInt</a></li>
<li><a href="#CStr">CStr</a></li>
<li><a href="#Compare">Compare</a></li>
<li><a href="#Find">Find</a></li>
<li><a href="#Hex">Hex</a></li>
<li><a href="#Len">Len</a></li>
<li><a href="#Lower">Lower</a></li>
<li><a href="#Pack">Pack</a></li>
<li><a href="#SizeOf">SizeOf</a></li>
<li><a href="#SplitWords">SplitWords</a></li>
<li><a href="#StrReplace">StrReplace</a></li>
<li><a href="#SubStr">SubStr</a></li>
<li><a href="#SubStrReplace">SubStrReplace</a></li>
<li><a href="#Trim">Trim</a></li>
<li><a href="#TypeOf">TypeOf</a></li>
<li><a href="#Unpack">Unpack</a></li>
<li><a href="#Upper">Upper</a></li>
<li><a href="#Print">Print</a></li>
</ul></span>
</div>
<div class="doc-smallbox-gold">
<div class="expander"><a href="javascript:ExpandContract('Modules')" id="bullet_Modules">[-]</a></div>
<center><h2>Modules:</h2></center>
<span id="span_Modules"><ul>
<li><a href="attributesem.html">
                      Attributes
          				  </a></li>
<li><a href="basicem.html">
                      Basic
          				  </a></li>
<li><a href="boatem.html">
                      Boat
          				  </a></li>
<li><a href="cfgfileem.html">
                      CfgFile
          				  </a></li>
<li><a href="clilocem.html">
                      CliLoc
          				  </a></li>
<li><a href="datafileem.html">
                      DataFile
          				  </a></li>
<li><a href="fileem.html">
                      File
          				  </a></li>
<li><a href="guildsem.html">
                      Guild
          				  </a></li>
<li><a href="httpem.html">
                      Http
          				  </a></li>
<li><a href="mathem.html">
                      Math
          				  </a></li>
<li><a href="npcem.html">
                      Npc
          				  </a></li>
<li><a href="osem.html">
                      OS
          				  </a></li>
<li><a href="partyem.html">
                      Party
          				  </a></li>
<li><a href="polsysem.html">
                      PolSys
          				  </a></li>
<li><a href="storageem.html">
                      Storage
          				  </a></li>
<li><a href="unicodeem.html">
                      Unicode
          				  </a></li>
<li><a href="uoem.html">
                      UO
          				  </a></li>
<li><a href="utilem.html">
                      Util
          				  </a></li>
<li><a href="vitalsem.html">
                      Vitals
          				  </a></li>
</ul></span>
</div>
</div>
<div class="doc-col_23">
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Bin">Bin(number)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>number</var></td>
<td>The number to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns the binary coded value of 'number'
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A binary coded number</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CAsc">CAsc(string)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>string</var></td>
<td>String to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts the first character of string to an ASCII code
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">ASCII code</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CAscZ">CAscZ(string)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>string</var></td>
<td>String to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts the string to an array of the character's ASCII codes
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">Array of ASCII values</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CChr">CChr(integer)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>number</var></td>
<td>Integer to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts an ASCII value to a string consisting of one character.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A character</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CChrZ">CChrZ(array)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>array</var></td>
<td>Array of ASCII values</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts an array of ASCII values to a string
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A string</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CDbl">CDbl(variable)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>variable</var></td>
<td>A variable Int or String</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts a string or int to a real. Only strings containing digits and '.' will return a predicatable result. 
Ints will be expanded.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A Real</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CInt">CInt(variable)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>variable</var></td>
<td>A variable Real or String</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts a string or real to an integer. Only strings containing digits and '.' will return a predicatable 
result. Doubles will be truncated.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An Int</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="CStr">CStr(variable)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>variable</var></td>
<td>A variable Int or Real</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts a real or int to a string.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A String</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Compare">Compare(str1, str2, pos1_start:=0, pos1_end:=0, pos2_start:=0, pos2_end:=0)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>str1</var></td>
<td>First string to compare</td>
</tr>
<tr>
<td width="50%"><var>str2</var></td>
<td>Second string to compare</td>
</tr>
<tr>
<td width="50%"><var>pos1_start</var></td>
<td>The index to start from first string</td>
</tr>
<tr>
<td width="50%"><var>pos1_end</var></td>
<td>The index to end from first string</td>
</tr>
<tr>
<td width="50%"><var>pos2_start</var></td>
<td>The index to start from second string</td>
</tr>
<tr>
<td width="50%"><var>pos2_end</var></td>
<td>The index to end from second string</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">
      Can be used in 3 overloaded ways. Returns 1 on compare success.
</td></tr>
<tr><td colspan="2"><pre>
Compare(string1, string2)
Compare(string1, string2, string1_index, string1_length)
Compare(string1, string2, string1_index, string1_length, string2_index, string2_length)
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">1 on compare success/0</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Index must not be negative for param 1"</td></tr>
<tr><td colspan="2">"Index out of range for param 1"</td></tr>
<tr><td colspan="2">"Index must not be negative for param 2"</td></tr>
<tr><td colspan="2">"Index out of range for param 2"</td></tr>
<tr><td colspan="2">"Length out of range for param 1"</td></tr>
<tr><td colspan="2">"Length must not be negative for param 1"</td></tr>
<tr><td colspan="2">"Length out of range for param 2"</td></tr>
<tr><td colspan="2">"Length must not be negative for param 2"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Find">Find(string, search, start)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>string</var></td>
<td>The string to search in</td>
</tr>
<tr>
<td width="50%"><var>search</var></td>
<td>The string to search for</td>
</tr>
<tr>
<td width="50%"><var>start</var></td>
<td>The index to start searching at</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns the index of the first occurance of 'search' after 'start' within 'string'
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An int</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Hex">Hex(number)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>number</var></td>
<td>The number to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns the hexidecimal value of 'number'
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A hexidecimal</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Len">Len(string|array)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>string|array</var></td>
<td>A string or array</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      For strings, returns string length. For arrays, returns number of elements. Does not work for structs or dictionaries, use .size() for those.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An Int</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Lower">Lower(string)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>string</var></td>
<td>A string to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts 'string' to lowercase (doesn't work with high-ascii characters or unicode)
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A string</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Pack">Pack(object)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>object</var></td>
<td>An object to pack</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Packs a variable into POL's packed data string format. Note that object references CANNOT be saved with the world, but may be passed to other running scripts, or with an event.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A string</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="SizeOf">SizeOf(expression)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>expression</var></td>
<td>An expression to evaluate</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns an estimate of the memory used
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An int</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="SplitWords">SplitWords( str, delimiter := " " )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>string</var></td>
<td>The string to split</td>
</tr>
<tr>
<td width="50%"><var>delimiter</var></td>
<td>The delimiter to use</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns an array of words contained in 'string'. Words are separated by the delimiter.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An array</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="StrReplace">StrReplace(string, to_replace, replace_with)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>string</var></td>
<td>The string to modify</td>
</tr>
<tr>
<td width="50%"><var>to_replace</var></td>
<td>The string to replace</td>
</tr>
<tr>
<td width="50%"><var>replace_with</var></td>
<td>The string to replace with</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">Replace all instances of to_replace in the string with replace_with. </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A String</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="SubStr">SubStr(string, start, length)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>string</var></td>
<td>The string to search within</td>
</tr>
<tr>
<td width="50%"><var>start</var></td>
<td>The index to start getting the substring from</td>
</tr>
<tr>
<td width="50%"><var>length</var></td>
<td>The length of the substring</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns the substring of 'string' beginning at 'start' for 'length'. This functions the same as virtual Substrings within eScript such as String[4,6]
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A String</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="SubStrReplace">SubStrReplace(string, replace_with, start, length:=0)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>string</var></td>
<td>The string to modify</td>
</tr>
<tr>
<td width="50%"><var>replace_with</var></td>
<td>The string to replace</td>
</tr>
<tr>
<td width="50%"><var>start</var></td>
<td>Integer start index</td>
</tr>
<tr>
<td width="50%"><var>length</var></td>
<td>Integer length</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">Replace portion of string using replace_with, beginning at start for length.</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A String</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Index must not be negative"</td></tr>
<tr><td colspan="2">"Index out of range"</td></tr>
<tr><td colspan="2">"Length out of range"</td></tr>
<tr><td colspan="2">"Length must not be negative"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Trim">Trim(string, type:=TRIM_BOTH, set:=" ")</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>string</var></td>
<td>The string to trim</td>
</tr>
<tr>
<td width="50%"><var>type</var></td>
<td>The trim type to use</td>
</tr>
<tr>
<td width="50%"><var>set</var></td>
<td>The string to trim as whitespace</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Trims whitespaces from strings.</td></tr>
<tr><td colspan="2">basic.em constants for type value:
</td></tr>
<tr><td colspan="2"><pre>
const TRIM_LEFT  := 0x1; // Trim whitespace from Left of string.
const TRIM_RIGHT := 0x2; // Trim whitespace from Right of string.
const TRIM_BOTH  := 0x3; // Trim whitespace from Left and Right of string.</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A String</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="TypeOf">TypeOf(variable)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>variable</var></td>
<td>a script var</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Returns a string, depending on the variable type of the parameter. Is one of: "Dictionary", 
      "AccountRef", "ConfigFileRef", "ConfigElemRef", "DataFileRef", "DataElemRef", "ScriptExRef", "GuildRef", 
      "BoundingBox", "DebugContext", "Package", "MenuRef", "MobileRef", "OfflineMobileRef",
      "ItemRef", "BoatRef", "MultiRef", "Unknown", "Uninit", "String", "Integer", "Double", "Array", "ApplicPtr",
      "ApplicObj", "Error", "Struct", "Packet".
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A string</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Unpack">Unpack(string)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>string</var></td>
<td>A string to unpack</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Unpacks a "packed data string" into the variable it represents. See Pack().
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A variable</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Upper">Upper(string)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>string</var></td>
<td>A string to convert</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Converts 'string' to uppercase (doesn't work with high-ascii characters or unicode)
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A string</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="Print">print(anything)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>anything</var></td>
<td>Any object, or primitive.</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">
      Prints 'anything' to the console. If it's a string or number, it will show the value. If it's an array, struct or dictionary, it will show the contents of the structure fairly nicely. On Packets it will show the content. Else, it shows the type of object, i.e. 'ItemRef'.
    </td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">Nothing</td></tr></tbody>
</table>
</div>
</div>
</div></div>
</div></div>
<div id="footer">
	<div class="container">
    <p >
      If you <i>know</i> if any information is incorrect on these pages, mail your corrections to polteam@polserver.com
    </p>
    <p >
      Copyright &copy;2003-2009 David Carpman and POL Development Team, all rights reserved. DO NOT REPRODUCE, MIRROR, ALTER, SPINDLE, MUTILATE, OR SIT ON.
    </p>
    </div>
    </div>
    </body>
    </html>
   